home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 24 / CU Amiga Magazine's Super CD-ROM 24 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-07].iso / CUCD / Utilities / vim-5.1 / syntax / csh.vim < prev    next >
Encoding:
Text File  |  1998-03-30  |  5.6 KB  |  130 lines

  1. " Vim syntax file
  2. " Language   : C-shell (csh)
  3. " Maintainer : Charles E. Campbell, Jr.
  4. " Last change: March 30, 1997
  5.  
  6. " Remove any old syntax stuff hanging around
  7. syn clear
  8.  
  9. " Variables which affect the csh itself
  10. syn match cshSetVariables    contained "argv\|histchars\|ignoreeof\|noglob\|prompt\|status"
  11. syn match cshSetVariables    contained "cdpath\|history\|mail\|nonomatch\|savehist\|time"
  12. syn match cshSetVariables    contained "cwd\|home\|noclobber\|path\|shell\|verbose"
  13. syn match cshSetVariables    contained "echo"
  14.  
  15. syn keyword cshTodo    contained TODO
  16.  
  17. " Variable Name Expansion Modifiers
  18. syn match cshModifier    contained ":\(h\|t\|r\|q\|x\|gh\|gt\|gr\)"
  19.  
  20. " Strings and Comments
  21. syn match   cshNoEndlineDQ    contained "[^\"]\(\\\\\)*$"
  22. syn match   cshNoEndlineSQ    contained "[^\']\(\\\\\)*$"
  23. syn match   cshNoEndlineBQ    contained "[^\`]\(\\\\\)*$"
  24.  
  25. syn region  cshDblQuote    start=+[^\\]"+lc=1 skip=+\\\\\|\\"+ end=+"+    contains=cshSpecial,cshShellVariables,cshExtVar,cshSelector,cshQtyWord,cshArgv,cshSubst,cshNoEndlineDQ,cshBckQuote
  26. syn region  cshSnglQuote    start=+[^\\]'+lc=1 skip=+\\\\\|\\'+ end=+'+    contains=cshNoEndlineSQ
  27. syn region  cshBckQuote    start=+[^\\]`+lc=1 skip=+\\\\\|\\`+ end=+`+    contains=cshNoEndlineBQ
  28. syn region  cshDblQuote    start=+^"+ skip=+\\\\\|\\"+ end=+"+        contains=cshSpecial,cshExtVar,cshSelector,cshQtyWord,cshArgv,cshSubst,cshNoEndlineDQ
  29. syn region  cshSnglQuote    start=+^'+ skip=+\\\\\|\\'+ end=+'+        contains=cshNoEndlineSQ
  30. syn region  cshBckQuote    start=+^`+ skip=+\\\\\|\\`+ end=+`+        contains=cshNoEndlineBQ
  31. syn match   cshComment    "#.*$" contains=cshTodo
  32.  
  33. " A bunch of useful csh keywords
  34. syn keyword cshStatement    alias    end    history    onintr    setenv    unalias
  35. syn keyword cshStatement    cd    eval    kill    popd    shift    unhash
  36. syn keyword cshStatement    chdir    exec    login    pushd    source
  37. syn keyword cshStatement    continue    exit    logout    rehash    time    unsetenv
  38. syn keyword cshStatement    dirs    glob    nice    repeat    umask    wait
  39. syn keyword cshStatement    echo    goto    nohup
  40.  
  41. syn keyword cshConditional    break    case    else    endsw    switch
  42. syn keyword cshConditional    breaksw    default    endif
  43. syn keyword cshRepeat    foreach
  44.  
  45. " Special environment variables
  46. syn keyword cshShellVariables    HOME    LOGNAME    PATH    TERM    USER
  47.  
  48. " Modifiable Variables without {}
  49. syn match cshExtVar    "\$[a-zA-Z_][a-zA-Z0-9_]*\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\="        contains=cshModifier
  50. syn match cshSelector    "\$[a-zA-Z_][a-zA-Z0-9_]*\[[a-zA-Z_]\+\]\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\="    contains=cshModifier
  51. syn match cshQtyWord    "\$#[a-zA-Z_][a-zA-Z0-9_]*\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\="        contains=cshModifier
  52. syn match cshArgv    "\$[0-9]\+\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\="            contains=cshModifier
  53. syn match cshArgv    "\$\*\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\="            contains=cshModifier
  54.  
  55. " Modifiable Variables with {}
  56. syn match cshExtVar    "\${[a-zA-Z_][a-zA-Z0-9_]*\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\=}"        contains=cshModifier
  57. syn match cshSelector    "\${[a-zA-Z_][a-zA-Z0-9_]*\[[a-zA-Z_]\+\]\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\=}"    contains=cshModifier
  58. syn match cshQtyWord    "\${#[a-zA-Z_][a-zA-Z0-9_]*\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\=}"    contains=cshModifier
  59. syn match cshArgv    "\${[0-9]\+\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\=}"            contains=cshModifier
  60.  
  61. " UnModifiable Substitutions
  62. syn match cshSubstError    "\$?[a-zA-Z_][a-zA-Z0-9_]*:\(h\|t\|r\|q\|x\|gh\|gt\|gr\)"
  63. syn match cshSubstError    "\${?[a-zA-Z_][a-zA-Z0-9_]*:\(h\|t\|r\|q\|x\|gh\|gt\|gr\)}"
  64. syn match cshSubstError    "\$?[0$<]:\(h\|t\|r\|q\|x\|gh\|gt\|gr\)"
  65. syn match cshSubst    "\$?[a-zA-Z_][a-zA-Z0-9_]*"
  66. syn match cshSubst    "\${?[a-zA-Z_][a-zA-Z0-9_]*}"
  67. syn match cshSubst    "\$?[0$<]"
  68.  
  69. " I/O redirection
  70. syn match cshRedir    ">>&!\|>&!\|>>&\|>>!\|>&\|>!\|>>\|<<\|>\|<"
  71.  
  72. " Handle set expressions
  73. syn keyword cshSetStmt    contained set unset
  74. syn region  cshSetExpr    transparent start="set\|unset" end="$\|;" contains=cshSetVariables,cshDblQuote,cshSnglQuote,cshBckQuote,cshSetStmt
  75.  
  76. " Operators and Expression-Using constructs
  77. syn keyword cshExprUsing    contained if while exit then
  78. syn match   cshOperator    contained "\(&&\|!\~\|!=\|<<\|<=\|==\|=\~\|>=\|>>\|\*\|\^\|\~\|||\|!\|\|%\|&\|+\|-\|/\|<\|>\||\)"
  79. syn match   cshOperator    contained "[(){}]"
  80. syn region  cshTest    transparent start="if\|while\|exit" skip="\\$" end="$\|;\|then" contains=cshOperator,cshExprUsing
  81.  
  82.  
  83. " Highlight special characters (those which have a backslash) differently
  84. syn match cshSpecial    contained "\\[0-9][0-9][0-9]\|\\[abcfnrtv\\]"
  85. syn match cshNumber    "-\=\<[0-9]\+\>"
  86.  
  87. " All other identifiers
  88. "syn match cshIdentifier    "\<[a-zA-Z._][a-zA-Z0-9._]*\>"
  89.  
  90. if !exists("did_csh_syntax_inits")
  91.   let did_csh_syntax_inits = 1
  92.   " The default methods for highlighting.  Can be overridden later
  93.   hi link cshArgv        cshVariables
  94.   hi link cshBckQuote    cshCommand
  95.   hi link cshDblQuote    cshString
  96.   hi link cshExprUsing    cshStatement
  97.   hi link cshExtVar    cshVariables
  98.   hi link cshNoEndlineBQ    cshNoEndline
  99.   hi link cshNoEndlineDQ    cshNoEndline
  100.   hi link cshNoEndlineSQ    cshNoEndline
  101.   hi link cshQtyWord    cshVariables
  102.   hi link cshSelector    cshVariables
  103.   hi link cshSetStmt    cshStatement
  104.   hi link cshSetVariables    cshVariables
  105.   hi link cshSnglQuote    cshString
  106.   hi link cshSubst    cshVariables
  107.  
  108.   hi link cshCommand    Statement
  109.   hi link cshComment    Comment
  110.   hi link cshConditional    Conditional
  111.   hi link cshIdentifier    Error
  112.   hi link cshModifier    Special
  113.   hi link cshNoEndline    Error
  114.   hi link cshNumber    Number
  115.   hi link cshOperator    Operator
  116.   hi link cshRedir    Statement
  117.   hi link cshRepeat    Repeat
  118.   hi link cshShellVariables    Special
  119.   hi link cshSpecial    Special
  120.   hi link cshStatement    Statement
  121.   hi link cshString    String
  122.   hi link cshSubstError    Error
  123.   hi link cshTodo    Todo
  124.   hi link cshVariables    Type
  125. endif
  126.  
  127. let b:current_syntax = "csh"
  128.  
  129. " vim: ts=18
  130.